package oj;

import java.util.Arrays;
import java.util.Scanner;

public class Day14S {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while (sc.hasNext()){
            int num=sc.nextInt();
            int[] arr=new int[num];
            for (int i = 0; i < arr.length; i++) {
                arr[i]=sc.nextInt();
            }
            Arrays.sort(arr);
            System.out.println(dfs(0,0,1,arr,num));

        }
    }

    private static int dfs(int index, int sum, long mul, int[] arr, int num) {
        int res=0;
        for (int i = index; i <num ; i++) {
            sum+=arr[i];
            mul*=arr[i];
            if(sum>mul){
                res+=1+dfs(i+1,sum,mul,arr,num);
            }else if(arr[i]==1){
                res+=dfs(i+1,sum,mul,arr,num);
            }else {
                break;
            }
            sum-=arr[i];
            mul/=arr[i];
            while (i<num-1 && arr[i]==arr[i+1]){
                i++;
            }
        }
        return res;
    }
}
